package com.gxa.service.impl;

import com.gxa.common.R;
import com.gxa.mapper.WarehouseMapper;
import com.gxa.pojo.Warehouse;
import com.gxa.service.WarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

//这个应该放在实现类中
@Service
public class WarehouseServiceImpl implements WarehouseService {

    @Autowired(required = false)
    private WarehouseMapper warehouseMapper;

    R r = new R();

    @Override
    public R queryWarehouseByStatus() {
        List<Map> warehouses = warehouseMapper.queryWarehouseByStatus();
        if(warehouses != null){
            r.setCode(200);
            r.setMsg("success");
            r.setData(warehouses);
        }else {
            r.setCode(405);
            r.setMsg("暂无仓库开放，请联系管理员");
        }
        return r;
    }
}
